package com.wjw.java.basic.method_;

import java.util.Arrays;

/**
 * 成员方法传参机制：传递引用数据类型：见member_method_reference_param_jvm.png
 * 形参值的变化会改变实参的值,因为形参中传递的是堆中的内存地址
 */
public class MemberMethodReferenceParam {
    public static void main(String[] args) {
        int [] arr = {1,2,3};
        ReferenceParam rp = new ReferenceParam();
        rp.changeArr(arr);//[10, 2, 3]
        System.out.println(Arrays.toString(arr));
        //[10, 2, 3]
    }
}

class ReferenceParam{
    public void changeArr(int [] arr){
        arr[0] = 10;
        System.out.println(Arrays.toString(arr));
    }
}
